<!DOCTYPE html>
<html>
<head>
{include file="public/meta"}
<title>用户登录 - {$maccms.site_name}</title>
<meta name="keywords" content="{$maccms.site_keywords}"/>
<meta name="description" content="{$maccms.site_description}"/>   
{include file="public/include"}
</head>
<body>
{include file="public/head"}
<div id="conch-content" class="conch-content">
<div class="conch-ctwrap">
    <div class="container">
    <div class="hl-member">
    <div class="hl-reg-wrap">
        <form class="hl-reg-form" method="post" id="fm" action="">
            <h2 class="hl-reg-title">用户登录</h2>
            <div class="hl-reg-group">
                <label>账号</label><input type="text" id="user_name" name="user_name" class="hl-reg-control" placeholder="输入手机号或登录账号">
            </div>
            <div class="hl-reg-group">
                <label>密码</label><input type="password" id="user_pwd" name="user_pwd" class="hl-reg-control" placeholder="输入您的登录密码">
            </div>
            {if condition="$GLOBALS['config']['user']['login_verify'] eq 1"}
            <div class="hl-reg-group">
                <label>验证码</label><input type="text" class="hl-reg-control hl-reg-w2" id="verify" name="verify" placeholder="输入验证码"><img class="hl-reg-w3" id="verify_img" src="{:url('verify/index')}" onClick="this.src=this.src+'?'"  alt="单击刷新" />
            </div>
            {/if}
            <input type="button" id="btn_submit" class="hl-btn-submit hl-bg-conch" value="立即登录">
        </form>
        <div class="hl-reg-go hl-text-center clearfix">
            <a href="{$maccms.path}">返回首页</a><a href="{:url('user/reg')}">注册账号</a><a href="{:url('user/findpass')}">忘记密码</a>
        </div>
        {if$GLOBALS['config']['connect']['qq']['status']==1||$GLOBALS['config']['connect']['weixin']['status']==1}
        <div class="hl-reg-other hl-text-center clearfix">
            <div class="hl-reg-info">您还可以用以下方式登录</div>
            <div class="hl-reg-oauth">
                {if condition="$GLOBALS['config']['connect']['weixin']['status'] eq 1"}
                <a class="hl-reg-wx" href="{:url('user/oauth')}?type=weixin"><i class="iconfont hl-icon-weixin"></i></a>
                {/if}
                {if condition="$GLOBALS['config']['connect']['qq']['status'] eq 1"}
                <a class="hl-reg-qq" href="{:url('user/oauth')}?type=qq"><i class="iconfont hl-icon-qq"></i></a>
                {/if}
            </div>
        </div>
        {/if}
    </div>
    </div>
    </div>
</div>
</div>
{include file="public/foot"}
<script type="text/javascript">
	$(function(){
		$("body").bind('keyup',function(event) {
			if(event.keyCode==13){ $('#btnLogin').click(); }
		});
		$('#btn_submit').click(function() {
			if ($('#user_name').val()  == '') { alert('请输入用户！'); $("#user_name").focus(); return false; }
			if ($('#user_pwd').val()  == '') { alert('请输入密码！'); $("#user_pwd").focus(); return false; }
			if ($('#verify').length> 0 && $('#verify').val()  == '') { alert('请输入验证码！'); $("#verify").focus(); return false; }
			$.ajax({
				url: "{:url('user/login')}",
				type: "post",
				dataType: "json",
				data: $('#fm').serialize(),
				beforeSend: function () {
					$("#btn_submit").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					if(r.code==1){
						location.href="{:url('user/index')}";
					}
					else{
						alert(r.msg);
						$('#verify_img').click();
					}
				},
				complete: function () {
					$("#btn_submit").css("background","#fa4646").val("立即登录");
				}
			});
		});
	});
</script>
</body>
</html>